#ifndef NR_DEVICE_PROPERTY_H
#define NR_DEVICE_PROPERTY_H

class nr_device_property : public nr_object
{
public:
    enum property_type_t
    {
        Invalid = 0,
        PropertyGroup,
        Property,
    };

public:
    nr_device_property();
    nr_device_property(nr_device_property& prop);
    ~nr_device_property();

    nr_device_property& operator = (nr_device_property &prop);
    
    nr_id_t& id() { return m_id;}
    QString& name() { return m_name; }
    QVariant& value() { return m_value; }
    property_type_t& property_type() { return m_propery_type; }
    static property_type_t parse_property_type(const QString &type_str);
    static QString property_type_to_string(property_type_t type);

    QString property_type_to_string();

    typedef QHash<nr_id_t, nr_device_property*> nr_device_property_hash;

    nr_device_property_hash &children() { return m_device_properties; }

    void serialize(QDataStream& data_stream);
    void deserialize(QDataStream& data_stream);
    
private:
    void copy_data(nr_device_property& prop);

    nr_id_t m_id;
    QString m_name;
    QVariant m_value;
    nr_device_property::property_type_t m_propery_type;
    nr_device_property_hash m_device_properties;
};

#endif // NR_DEVICE_PROPERTY_H
